﻿using DXApplicationTangche.UC.抖音出入库.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.抖音出入库.抖音下单
{
    public partial class Form秒杀创建款式 : DevExpress.XtraEditors.XtraForm
    {
        private Boolean if预售 = false;

        public Form秒杀创建款式()
        {
            InitializeComponent();
            this.comboBox是否预售.SelectedIndex = 0;
        }

        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.richTextBox商品描述.Text.Trim())
                || String.IsNullOrEmpty(this.textBox单价.Text.Trim()))
            {
                MessageBox.Show("请将商品信息补充完整");
                return;
            }
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "gif,jpg,png|*.gif;*.jpg;*.png;*.jpeg";
                ofd.Title = "请选择图片文件";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    零售Service.createSku(
                        this.richTextBox商品描述.Text.Trim(),
                        this.if预售,
                        Convert.ToDouble(this.textBox单价.Text.Trim()),
                        "SSHIRT",
                        "18",
                        ofd.FileName);
                    MessageBox.Show("操作完成");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("操作失败");
            }
            this.Close();
        }

        private void comboBox是否预售_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(this.comboBox是否预售.SelectedIndex == 0)
            {
                this.if预售 = false;
            }
            else
            {
                this.if预售 = true;
            }
        }
    }
}
